package com.zy.studentSide.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.studentSide.dao.StudentInformationDao;
import com.zy.studentSide.entity.StudentInformation;
import com.zy.studentSide.service.IStudentInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 29787
 */
@Service
public class IStudentInformationServiceImpl
        extends ServiceImpl<StudentInformationDao, StudentInformation>
        implements IStudentInformationService {

    @Autowired
    private StudentInformationDao studentInformationDao;

    @Override
    public IPage<StudentInformation> getPage(Integer currentPage, Integer pageSize, Integer teacherId) {
        IPage<StudentInformation> page = new Page<>(currentPage, pageSize);
        LambdaQueryWrapper<StudentInformation> lqw = new LambdaQueryWrapper<>();
        lqw.eq(true,StudentInformation::getTeacherId,teacherId);
        studentInformationDao.selectPage(page,lqw);
        return page;
    }

    @Override
    public StudentInformation getStudentInformationByStudentNum(String studentNum) {
        return studentInformationDao.getStudentInformationByStudentNum(studentNum);
    }

    @Override
    public StudentInformation getStudentInformationByTeacherId(String studentNum,Integer teacherId) {
        return studentInformationDao.getStudentInformationByTeacherId(studentNum,teacherId);
    }
}
